<?php

namespace App\Events\Auth;

use App\Models\AbstractUser;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Auth\Authenticatable;

class Login
{
    use SerializesModels;

    /**
     * 当前用户
     *
     * @var AbstractUser|Authenticatable
     */
    public $user;

    /**
     * 是否记住密码
     *
     * @var bool
     */
    public $remember;

    /**
     * 登录IP
     *
     * @var string
     */
    public $ip;

    /**
     * User Agent
     *
     * @var string
     */
    public $userAgent;

    /**
     * Login constructor.
     *
     * @param AbstractUser|Authenticatable $user
     * @param string $ip
     * @param string $userAgent
     * @param bool $remember
     */
    public function __construct(Authenticatable $user, $ip, $userAgent, $remember = false)
    {
        $this->user = $user;
        $this->remember = $remember;
        $this->ip = $ip;
        $this->userAgent = $userAgent;
    }
}
